package com.hzlj.position.config.converter;

import com.fz.common.base.converter.ModelDTOConverter;
import com.fz.common.base.core.date.DateUtils;
import com.hzlj.position.config.common.dto.operatorActivationLogs.OperatorActivationLogsAddDTO;
import com.hzlj.position.config.common.dto.operatorActivationLogs.OperatorActivationLogsQueryResultDTO;
import com.hzlj.position.config.common.model.OperatorActivationLogs;

/**
 * 定位-运营商开通-日志(OperatorActivationLogs)DTO转换类
 *
 * @author lifh
 * @date 2023-08-17 18:16:57
 */
public class OperatorActivationLogsConverter {
    /**
     * model实例转换为查询结果DTO
     *
     * @param model model实例
     * @return DTO
     */
    public static OperatorActivationLogsQueryResultDTO from(OperatorActivationLogs model) {
        return ModelDTOConverter.from(model, OperatorActivationLogsQueryResultDTO.class);
    }

    /**
     * 新增DTO转换为model实例
     *
     * @param dto 新增DTO
     * @return model实例
     */
    public static OperatorActivationLogs from(OperatorActivationLogsAddDTO dto) {
        return ModelDTOConverter.from(dto, OperatorActivationLogs.class, (OperatorActivationLogs l) -> {
            l.setCreateTime(DateUtils.now());
        });

    }
}
